Release 10.1A: OpenEdge Data Management:
DataServer for ORACLE
Using field lists when updating records
You can instruct the DataServer to use field lists when your application needs to update records. The DataServer uses the technique of optimistic updates to allow you to retrieve and update only the fields you need. ORACLE handles the record-locking when the update occurs. Activate this feature by specifying
Note: Optimistic updates are not allowed for-Dsrvoptimisticwhen you start the DataServer.LONG,RAW, andLONGRAWcolumns.Typically, an application has to obtain a record with an
EXCLUSIVE-LOCK(either by explicitly specifying theEXCLUSIVE-LOCKor by aSHARE-LOCKthat is upgraded toEXCLUSIVE-LOCK). Optimistic updates allow changes to be made to records that you retrieveNO-LOCK. Since field lists require that you obtain records withNO-LOCK, you can use field lists combined with optimistic updates to perform updates without retrieving the entire record. For example, the following code is acceptable if you specify the-Dsrvoptimisticstartup parameter:
The DataServer generates SQL similar to the following:
The bind variable
:x1represents the new value for the name column and:o1supplies the old value. The clause,WHEREcust_num=:rid, specifies which row to update (in this examplecust_numsupports the Progress 4GLROWIDfunction). Thename=:o1portion of theWHEREclause prevents theUPDATEfrom taking place if another client has changed the name column while your client was holding itNO-LOCK.The DataServer instructs ORACLE to compare the old value of name to its present value. If the values are the same (indicating that no one changed the record while your client held the record
Caution: Using optimistic locking can cause the application to appear to hang. If one user already has a record locked prior to a second user executing the above 4GL with optimistic locking, the second user’s application will appear to hang waiting for the first user to release the record. The standard table in use message is not displayed.NO-LOCK), ORACLE updates the field. This feature enhances performance by reducing concurrency problems resulting from locks held for long periods and by reducing network traffic, as you can send only those fields you want to update.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |